package com.zztt.logmask.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * spring boot项目为了注册日志类
 */
public class CupdataZiconSpringApplicationRunListener implements SpringApplicationRunListener {
    static {
        try {
            //如果有MessageConverter这个类  则注册logback的CupdataZiconRollingFileAppender
            Class.forName("ch.qos.logback.classic.pattern.MessageConverter");
            Class.forName("com.zztt.logmask.logback.CupdataZiconRollingFileAppender");
        } catch (ClassNotFoundException e) {
            //异常无需处理
        }
    }

    public CupdataZiconSpringApplicationRunListener(SpringApplication application, String[] args) {
    }

    @Override
    public void starting() {

    }

    @Override
    public void environmentPrepared(ConfigurableEnvironment environment) {

    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {

    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {

    }

    @Override
    public void finished(ConfigurableApplicationContext context, Throwable exception) {

    }
}
